package com.b.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 秒杀活动实体类
 */
@Document(indexName = "seckillactivity")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SeckillActivity implements Serializable {
    /**
     * 秒杀活动ID
     */
    @Id
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer id;

    /**
     * 秒杀活动名称
     */
    @Field(type = FieldType.Text, index = true , store = true, analyzer = "ik_max_word")
    private String name;

    /**
     * 关联的商品ID
     */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer productId;

    /**
     * 秒杀价格
     */
    @Field(type = FieldType.Double, index = false , store = true)
    private BigDecimal seckillPrice;

    /**
     * 秒杀总库存
     */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer totalStock;

    /**
     * 秒杀开始时间
     */
    @Field(type = FieldType.Date, index = false , store = true)
    private Date startTime;

    /**
     * 秒杀结束时间
     */
    @Field(type = FieldType.Date, index = false , store = true)
    private Date endTime;

    /**
     * 秒杀活动状态：0-未开始，1-进行中，2-已结束
     */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer status;

    /**
     * 创建时间
     */
    @Field(type = FieldType.Date, index = false , store = true)
    private Date createTime;

    /**
     * 联查商品
     */
    private  Product product;

}
